home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 85 / CD Temático 40 Febrero 2004.iso / DOS / testdisk / src / lvm.h < prev    next >
Encoding:
C/C++ Source or Header  |  2004-01-02  |  2.6 KB  |  102 lines

  1. /*
  2.      File: lvm.c, TestDisk
  3.  
  4.     Copyright (C) 1998-2004 Christophe GRENIER <grenier@cgsecurity.org>
  5.     Same wunderfull license.
  6.  */   
  7. /* gm_hmlvm.h -- gpart Linux LVM physical volume guessing module header
  8.  * 
  9.  * gpart (c) 1999-2001 Michail Brzitwa <mb@ichabod.han.de>
  10.  * Guess PC-type hard disk partitions.
  11.  *
  12.  * gpart is free software; you can redistribute it and/or modify
  13.  * it under the terms of the GNU General Public License as published
  14.  * by the Free Software Foundation; either version 2, or (at your
  15.  * option) any later version.
  16.  *
  17.  * Created:   29.08.1999 <mb@ichabod.han.de>
  18.  * Modified:  
  19.  *
  20.  */
  21.  
  22. #ifndef _GM_HMLVM_H
  23. #define _GM_HMLVM_H
  24.  
  25. /*
  26.  * structs & defines gathered from LVM 0.7/0.9 lvm.h and liblvm.h
  27.  */
  28.  
  29. #if !defined(__FreeBSD__)
  30. typedef unsigned char uint8_t;
  31. typedef unsigned short uint16_t;
  32. typedef unsigned int uint32_t;
  33. #endif
  34.  
  35.  
  36. /*
  37.  * Status flags
  38.  */
  39.  
  40. /* physical volume */
  41. #define PV_ACTIVE        0x01    /* pv_status */
  42. #define PV_ALLOCATABLE        0x02    /* pv_allocatable */
  43.  
  44.  
  45. #define LVM_PV_DISK_BASE    0L
  46. #define LVM_PV_DISK_SIZE    1024L
  47. #define NAME_LEN        128    /* don't change!!! */
  48. #define UUID_LEN        16    /* don't change!!! */
  49. #define LVM_MAX_SIZE        ( 1024LU * 1024 * 1024 * 2)    /* 1TB[sectors] */
  50. #define LVM_ID            "HM"
  51. #define LVM_DIR_PREFIX        "/dev/"
  52. #define MAX_LV            256
  53. #define LVM_MIN_PE_SIZE        ( 8L * 2)    /* 8 KB in sectors */
  54. #define LVM_MAX_PE_SIZE        ( 16L * 1024L * 1024L * 2)    /* 16GB in sectors */
  55.  
  56. /* disk stored pe information */
  57. typedef struct {
  58.     uint16_t lv_num;
  59.     uint16_t le_num;
  60. } disk_pe_t;
  61.  
  62. /* disk stored PV, VG, LV and PE size and offset information */
  63. typedef struct {
  64.     uint32_t base;
  65.     uint32_t size;
  66. } lvm_disk_data_t;
  67.  
  68. /*
  69.  * Structure Physical Volume (PV) Version 2
  70.  */
  71.  
  72. /* disk */
  73. typedef struct {
  74.     uint8_t id[2];        /* Identifier */
  75.     uint16_t version;        /* HM lvm version */
  76.     lvm_disk_data_t pv_on_disk;
  77.     lvm_disk_data_t vg_on_disk;
  78.     lvm_disk_data_t pv_uuidlist_on_disk;
  79.     lvm_disk_data_t lv_on_disk;
  80.     lvm_disk_data_t pe_on_disk;
  81.     uint8_t pv_uuid[NAME_LEN];
  82.     uint8_t vg_name[NAME_LEN];
  83.     uint8_t system_id[NAME_LEN];    /* for vgexport/vgimport */
  84.     uint32_t pv_major;
  85.     uint32_t pv_number;
  86.     uint32_t pv_status;
  87.     uint32_t pv_allocatable;
  88.     uint32_t pv_size;        /* HM */
  89.     uint32_t lv_cur;
  90.     uint32_t pe_size;
  91.     uint32_t pe_total;
  92.     uint32_t pe_allocated;
  93. } pv_disk_v2_t;
  94.  
  95. #define pv_disk_t pv_disk_v2_t
  96. int check_LVM(t_param_disk *disk_car,t_diskext *partition,const int debug);
  97. int test_LVM(t_param_disk *disk_car, const pv_disk_t *pv,t_diskext *partition,const int debug, const int dump_ind);
  98. int recover_LVM(t_param_disk *disk_car, const pv_disk_t *pv,t_diskext *partition,const int debug, const int dump_ind);
  99.  
  100.  
  101. #endif /* _GM_HMLVM_H */
  102.